<%@ page contentType="text/html; charset=UTF-8" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
<%@ taglib prefix="string" uri="http://jakarta.apache.org/taglibs/string-1.1" %>
<%@ taglib uri="/WEB-INF/tlds/pagination.tld" prefix="pagination" %>
<%@ taglib prefix="spring" uri="http://www.springframework.org/tags"%>

<html>
<head>
    <title>Bettersoft Portal</title>
    <link href="/common/css/style.css" rel="stylesheet" type="text/css"/>
    <script type="text/javascript" src="/common/js/common.js"></script>
    <script type='text/javascript' src="/common/dwr/engine.js"></script>
    <script type='text/javascript' src="/common/dwr/util.js"></script>
    <script type="text/javascript">
        // 페이지 이동을 처리한다.
        function goListPage(page) {
            var TheForm = document.frm;
            TheForm.currentPage.value = page;
            TheForm.nextTarget.value = 'communityBoardList';
            TheForm.action = './communityBoardList.do';
            TheForm.submit();
        }

        // 검색어로 리스트를 출력한다.
        function jsSearchList() {
            var TheForm = document.frm;
            TheForm.title.value = TheForm.search_title.value;
            TheForm.writer_id.value = TheForm.search_writer.value;
            TheForm.writer_nick_name.value = TheForm.search_nickName.value;
            TheForm.content.value = TheForm.search_content.value;
            TheForm.nextTarget.value = 'communityBoardList';
            TheForm.action = './getBoardListBySearchword.do';
            TheForm.submit();
        }

        // Board List 페이지로 이동한다.
        function jsBoardList() {
            var TheForm = document.frm;
            TheForm.nextTarget.value = "communityBoardList";	// page name
            TheForm.action = "./communityBoardContent.do";
            TheForm.submit();
        }

        // 글 작성 Action 을 수행한다.
        function jsWriteAction() {
            var TheForm = document.writeFrm;
            if(trim(TheForm.title.value) == "") {
                alert('<spring:message code="communityBoardWrite.alert1" />');
                TheForm.title.value = "";
                TheForm.title.focus();
                return false;
            }else if(trim(TheForm.content.value) == ""){
                alert('<spring:message code="communityBoardWrite.alert2" />');
                TheForm.content.value = "";
                TheForm.content.focus();
                return false;
            }else{
                TheForm.nextTarget.value = "./communityBoardList.do?&title&writer_id&writer_nick_name&&content";	// page name
                TheForm.action = "./communityBoardWriteAction.do";
                TheForm.submit();

            }
        }

        // Community Board List 페이지로 이동한다.
        function jsCommunityBoardList() {
            var TheForm = document.menuFrm;
            TheForm.nextTarget.value = "communityBoardList";	// page name
            TheForm.action = "./communityBoardList.do";
            TheForm.submit();
        }

        // Photo Board List 페이지로 이동한다.
        function jsPhotoBoardList() {
            var TheForm = document.menuFrm;
            TheForm.nextTarget.value = "photoBoardList";	// page name
            TheForm.action = "./photoBoardList.do";
            TheForm.submit();
        }

        // Notice Board List 페이지로 이동한다.
        function jsNoticeBoardList() {
            var TheForm = document.menuFrm;
            TheForm.nextTarget.value = "noticeBoardList";	// page name
            TheForm.action = "./noticeBoardList.do";
            TheForm.submit();
        }

        // Contact Us 페이지로 이동한다.
        function jsContactUs() {
            var TheForm = document.menuFrm;
            TheForm.nextTarget.value = "contactus";	// page name
            TheForm.action = "./contactus.do";
            TheForm.submit();
        }

        // FAQ 페이지로 이동한다.
        function jsFAQ() {
            var TheForm = document.menuFrm;
            TheForm.nextTarget.value = "faq";	// page name
            TheForm.action = "./faq.do";
            TheForm.submit();
        }

        // writeFrm 의 첨부파일 버튼 초기화
        function jsFileReset() {
            var obj = eval("writeFrm.fileUp");
            var obj2 = obj.cloneNode(false);
            obj.parentNode.replaceChild(obj2, obj);
            // obj 에 원래 file 필드를 가져와서 clone 노드 obj2 와 바꿔치기
        }

    </script>
</head>


<body>
<div id="wrapper">
    <!------------------------------ top 시작-------------------------------------->
    <%@include file="portalHeader.jsp" %>
    <!------------------------------ top 끝-------------------------------------->
    <div class="sub_content">
        <form name="writeFrm" method="POST" enctype="multipart/form-data">
            <input type="hidden" name="writer_id" value="<%=s.getAttribute("userId")%>">
            <input type="hidden" name="writer_nick_name" value="<%=s.getAttribute("nickName")%>">
            <input type="hidden" name="writer_password" value="">
            <input type="hidden" name="writer_email" value="<%=s.getAttribute("email")%>">
            <input type="hidden" name="add_file_yn" value="">
            <input type="hidden" name="nextTarget" value="">
            <input type="hidden" name="currentPage" value="${currentPage}">

            <img src="/images/intro/sub_title03.gif" />
            <table class="notice_tb">
                <tr>
                    <td width="17%" class="notice_tb_headfirst03"><spring:message code="communityBoardWrite.writer_id" /> : <%=s.getAttribute("userId")%></td>
                    <td width="16%" class="notice_tb_head02"><spring:message code="communityBoardWrite.nick_name" /> : <%=s.getAttribute("nickName")%></td>
                    <td width="53%" class="notice_tb_head02"><spring:message code="communityBoardWrite.email" /> : <%=s.getAttribute("email")%></td>
                    <td width="14%" class="notice_tb_headlast">&nbsp;</td>
                </tr>
                <tr>
                    <td colspan="4" class="write_tb"><spring:message code="communityBoardWrite.title" />
                        <input name="title" type="text" id="title" size="179" class="write_title" onkeyPress="if (event.keyCode==13){return false;}" /></td>
                </tr>
                <tr>
                    <td colspan="4" class="write_tb"><textarea name="content" id="content" cols="45" rows="20" class="write_textarea"></textarea></td>
                </tr>
                <tr>
                    <td colspan="4" class="write_tb02"><spring:message code="communityBoardWrite.file" />
                        <input name="fileUp" type="file" id="fileUp" size="50" class="write_attach" />
                        <a href="javascript:jsFileReset()"><img src="/images/intro/btn_del03.gif" class="write_btn" /></a></td>
                </tr>
            </table>
            <!---------------------------------------- 버튼 -------------------------------------->
            <div class="btn_right02">
                <a href="javascript:jsWriteAction()"><img src="/images/intro/btn_write02.gif" /></a>
            </div>
            <div class="btn_left">
                <a href="javascript:jsCommunityBoardList()"><img src="/images/intro/btn_list.gif" /></a>
            </div>
        </form>
    </div>
    <!------------------------------ 하위메뉴 시작-------------------------------------->
    <%@include file="portalFooter.jsp" %>
    <!------------------------------ 하위메뉴 끝-------------------------------------->
</div>
</body>
</html>